﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/jquery.signalR-2.1.2.min.js"></script>
    <!--With the generated proxy-->
    <!--<script src="http://www.contoso.com/signalr/hubs"></script>-->
    <script>
        $(document).ready(function () {
            var url = "http://10.30.47.105/signalr";
            $.getScript(url + "/hubs", function (data, textStatus, jqxhr) {
                // textStatus == Success; jqxhr.status == 200;
                $.connection.hub.qs = { 'version': '1.0' };
                $.connection.hub.loging = true;
                var task = $.connection.taskHub;
                task.client.broadcastMessage = function (name, message) {
                };
                
                $.connection.hub.url = url;
                $.connection.hub.start()
                    .done(function () {
                        console.log("Hub Connected, transport = " + $.connection.hub.transport.name + ":" + $.connection.hub.id);

                    }).fail(function (reason) {
                        console.log(reason);
                    });
            });
        });
        
    </script>



    <!--Without the generated proxy-->
    <!--SEC7118: XMLHttpRequest for http:// required Cross Origin Resource Sharing (CORS).-->    
    <script>
        //var connection = $.hubConnection("http://www.contoso.com");
        //connection.qs = { 'version': '1.0' };
        //var task = connection.createHubProxy('TaskHub');
        //task.on('send', function (name, message) {
        //    var encodedName = $('<div />').text(name).html();
        //    var encodedMsg = $('<div />').text(message).html();
        //    $('#discussion').append('<li><strong>' + encodedName
        //        + '</strong>:&nbsp;&nbsp;' + encodedMsg + '</li>');
        //});
        
        //connection.logging = true;
        //connection.start()
        //    .done(function () {
        //        console.log("Connected, transport = " + connection.transport.name + ":" + connection.id);
        //        $('#sendmessage').click(function () {
        //            task.invoke('send', $('#displayname').val(), $('#message').val());
        //            $('#message').val('').focus();
        //        });
        //    }).fail(function (reason) {
        //        console.log(reason);
        //    });
    </script>
    
</head>
<body>
    <div id="discussion"></div>

    <input id="displayname" type="text" />
    <input id="message" type="text" />
    <input id="sendmessage" type="button">
</body>
</html>
